package com.server.modules.api.service;

import com.server.common.utils.IdGen;
import com.server.modules.sys.entity.gps.Gps;
import com.server.modules.sys.service.gps.GpsService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

/**
 * Author Administrator
 * Date 2016/7/26
 */
@Service
public class GpsAPIService extends GpsService {

	/**
	 * 上传GPS信息
	 * @param gps
	 * @return
	 */
	@Transactional(readOnly = false)
	public Gps insertGps(Gps gps) {
		//只添加记录，不更新
		gps.setId(IdGen.uuid());
		gps.setIsNewRecord(true);
		gps.setCreateBy(gps.getCurrentUser());
		gps.setCreateDate(new Date());
		save(gps);
		//返回刚刚添加成功的GPS信息
		return get(gps.getId());
	}
}
